<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    {:token()}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" data-rule="required" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[start_time]" type="text" value="{$row.start_time|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Week_str')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-week_str"  class="form-control selectpicker" multiple="true" name="row[week_str][]">
                {foreach name="week_arr" item="vo"}
                <option value="{$key}" {if in_array($key,$row['week_str'])}selected{/if}>{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">年级组:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-grade_group_arr"  class="form-control selectpicker" multiple="true" name="row[grade_group_arr][]">
                {foreach name="grade_group_arr" item="vo"}
                <option value="{$vo.id}" {if in_array($vo.id,$row['grade_group_str'])}selected{/if}>{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="button" class="btn btn-primary" id="generateTable">确认</button>
        </div>
    </div>

    <!-- 生成的表格 -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div id="tableContainer"  class="col-xs-12 col-sm-8">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>日期</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                {foreach name="$row['item_arr']" item="vo"}
                <tr>
                    <td>{:date('Y-m-d',strtotime($vo['select_time']))}</td>
                    <td style="text-align: center;">
                        <input id="c-switch-{:date('Y-m-d',strtotime($vo['select_time']))}" name="row[switch]" type="hidden" value="{$vo['status']}">
                        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch-{:date('Y-m-d',strtotime($vo['select_time']))}" data-yes="1" data-no="0" >
                            {if $vo['status'] == 1}
                            <i class="fa fa-toggle-on text-success fa-2x"></i>
                            {else}
                            <i class="fa fa-toggle-on text-success fa-2x fa-flip-horizontal text-gray"></i>
                            {/if}
                        </a>
                    </td>
                </tr>
                {/foreach}
                </tbody>
            </table>

        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <input id="tableData" type="hidden" class="form-control" name="row[table_data]"  value="">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
